package by.myteam.gonki.states.mainstate;

import java.awt.event.KeyEvent;

import javax.swing.JPanel;

import by.myteam.gonki.gui.MainFrame;
import by.myteam.gonki.gui.view.GameOverView;


public class GameOverState implements IGameState {

	private JPanel state = new GameOverView();
	@Override
	public void perform() {
		MainFrame.INSTANCE.changeState(EGameStates.GAMEOVER.getState());
		MainFrame.INSTANCE.getTravelTime().stop();
	}

	@Override
	public JPanel getView() {
		return state;
	}

	@Override
	public void keyPressed(KeyEvent e) {
		if(e.getKeyCode() ==  KeyEvent.VK_ESCAPE && MainFrame.INSTANCE.getCurrentState() == this){
			System.out.println("MENU");
			EGameStates.MENU.getState().perform();
		}
	}



}
